package com.mi.global.shop;


import android.app.ActivityManager;
import android.app.Application;
import android.content.Context;


import com.mi.global.shop.common.utils.Device;
import com.mi.global.shop.common.utils.FrescoUtils;
import com.mi.global.shop.common.utils.PtrLocalDisplay;
import com.mi.global.shop.common.utils.ScreenInfo;
import com.xiaomi.mipush.sdk.MiPushClient;


import java.io.File;
import java.util.List;

/**
 * Created by laihengyu on 2017/9/27.
 */

public class BaseApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        initFresco(getApplicationContext());
        ScreenInfo.getInstance().initialScreenInfo(getApplicationContext());
        PtrLocalDisplay.init(getApplicationContext());
        Device.init(getApplicationContext());
//        initMiPush();
    }

    public static void initFresco(Context context) {
        FrescoUtils.init(context, 10);
    }



//    private boolean shouldInit() {
//        ActivityManager am = ((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE));
//        List<ActivityManager.RunningAppProcessInfo> processInfos = am.getRunningAppProcesses();
//        String mainProcessName = getPackageName();
//        int myPid = Process.myPid();
//        for (ActivityManager.RunningAppProcessInfo info : processInfos) {
//            if (info.pid == myPid && mainProcessName.equals(info.processName)) {
//                return true;
//            }
//        }
//        return false;
//    }
}
